﻿using System;
using System.Text;

namespace Jerkymon.Strings
{
    public class Encode
    {
		#region Static Methods (3)
		/// <summary>
        /// To Avoid Spam ... see URL http://www.codeproject.com/aspnet/spambot.asp for more info.
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public static string EncodeEmailAddress(string email)
        {
            return BitConverter.ToString(
                ASCIIEncoding.ASCII.GetBytes(email)).Replace("-", "");
        }

		public static string Hex(string tohex)
        {
            uint num1 = 0;
            try
            {
                num1 = Convert.ToUInt32(tohex);
            }
            catch (OverflowException)
            {
                return "Overflow";
            }
            return string.Format("{0:x2}", num1);
        }

		public static string HexToInt(string toint)
        {
            uint num1 = 0;
            try
            {
                num1 = Convert.ToUInt32(toint, 0x10);
            }
            catch (OverflowException)
            {
                return "Overflow";
            }
            return num1.ToString();
        }
		#endregion
    }
}
